<?php
/**
 * Created by IntelliJ IDEA.
 * User: lee
 * Date: 2018/10/31
 * Time: 6:31 PM
 */
ini_set('display_errors', 1);
error_reporting(-1);
require_once '/data/wwwroot/g_vendor/autoload.php';


use Biz\model\trade\Order as mOrder;
use Doraemon\cache\Queue as cQueue;
use Doraemon\cache\Token as TokenCache;
use Doraemon\service\MemberRoleTag;


$orderList = mOrder::select(['uid'],['pay_no[!]'=>'']);

$userIds = array_values(array_column($orderList,'uid','uid'));


if(empty($userIds)){
    return;
}


foreach ($userIds as $uid){
    $vid=TokenCache::getVidByUid($uid);

    cQueue::insertQueue('queue/UserRole/SaveRoleTag', [
        'vid' => !empty($vid)?$vid:'0',//vid
        'tag_id' => MemberRoleTag::ROLE_TAG_BUY,//分群id
        'value' => '2',//对应的值
        'uid' => $uid,
    ], cQueue::QUEUE_ROLE_TAG);
}

